﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Text;
using System.Web.UI;
using AnyOffice.DAL;
using AnyOffice.Components;
using AnyOffice.Model;

namespace AnyOffice.general.status_bar
{
    public partial class sms_back : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("<script Language=\"JavaScript\">");
                builder.Append("document.Form1.txtContent.focus();");
                builder.Append("</script>");
                this.Page.RegisterStartupScript("onload", builder.ToString());
                string str = (Request.QueryString["to_id"] != null) ? Request.QueryString["to_id"].ToString() : "";
                string str2 = (Request.QueryString["to_name"] != null) ? Request.QueryString["to_name"].ToString() : "";
                this.ToId.Value = str;
                this.ToName.Value = str2;
            }
            if (this.Page.IsPostBack)
            {
                SmsData data = new SmsData();
                SmsDao dao = new SmsDao();
                data.FromId = base.User.Identity.Name;
                data.ToId = this.ToId.Value;
                data.Type = 0;
                data.Content = this.txtContent.Value;
                dao.BizSend(base.Conn, data, true, false);
                StringBuilder builder2 = new StringBuilder();
                builder2.Append("<script Language=\"JavaScript\">");
                builder2.Append("self.close();");
                builder2.Append("</script>");
                this.Page.RegisterClientScriptBlock("WindowClose", builder2.ToString());
            }
        }
 

    }
}
